home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_weap_blastech_m.cog < prev    next >
Text File  |  1998-02-25  |  8KB  |  280 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # WEAP_BLASTECH_M.COG
  4. #
  5. # WEAPON 12 Script - Blastech Pistol
  6. #
  7. # Mara's signature weapon.
  8. #
  9. # - Affected by MagSealed sectors/surfaces.
  10. #
  11. # [YB & CYW] + [RF]
  12. #
  13. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  14.  
  15.  
  16. symbols
  17.  
  18. model       povModel=blsv.3do                   local
  19. model       povModel_m=blsv_m.3do               local
  20. model       weaponMesh=blsg.3do                 local
  21.  
  22. keyframe    mountAnim=blsvmnt.key               local
  23. keyframe    dismountAnim=blsvdis.key            local
  24. keyframe    povfireAnim=blsvpst1.key            local
  25. keyframe    holsterAnim=kyhlstr.key             local
  26.  
  27. sound       outSound=pistout1.wav               local
  28. sound       mountSound=df_bry_ready.wav         local
  29. sound       dismountSound=PutWeaponAway01.wav   local
  30. sound       fireSound=hsblaster.wav             local
  31. #sound         chargeSound=scalarm.wav             local
  32. sound       chargeSound=BCChargeUp.wav          local
  33. sound       failSound=weapfail.wav              local
  34.  
  35. template    projectile=+bryarbolt               local
  36. template    projectileB=+swsparks               local
  37.  
  38. thing       player                              local
  39. thing       victim                              local
  40. thing       potential                           local
  41.  
  42. flex        dot                                 local
  43. flex        maxDot                              local
  44.  
  45. flex        fireWait=0.5                        local
  46. flex        holsterWait                         local
  47. flex        fireDelay=0.6                       local
  48. flex        powerBoost                          local
  49. flex        autoAimFOV=30                       local
  50. flex        autoAimMaxDist=5                    local
  51.  
  52. int         weaponIndex                         local
  53. int         trackID=-1                          local
  54. int         dummy=0                             local
  55. int         mode                                local
  56. int         holsterTrack                        local
  57.  
  58. int         i                                   local
  59. int         iBlastSize                          local
  60. int         powerChannel                        local
  61. vector      vFire                               local
  62.  
  63. message     activated
  64. message     deactivated
  65. message     selected
  66. message     deselected
  67. message     autoselect
  68. message     fire
  69. message     timer
  70.  
  71. end
  72.  
  73. # ========================================================================================
  74.  
  75. code
  76.  
  77. fire:
  78.    player = GetSourceRef();
  79.  
  80.    // Check that the player is still alive.
  81.    if(GetThingHealth(player) <= 0)
  82.       Return;
  83.  
  84.    if (mode == 1)
  85.    {
  86.       if ((GetInv(player, 11) >= 1.0) && (iBlastSize < 4))
  87.       {
  88.          ChangeInv(player, 11, -1.0);
  89.  
  90.          iBlastSize = iBlastsize + 1;
  91.  
  92.          dot = 0.80 + iBlastSize * 0.20;
  93.          powerChannel = PlaySoundThing(chargeSound, player, 1.0, -1.0, -1.0, 0x80);
  94.          ChangeSoundPitch(powerChannel, dot, 0.0);
  95.       }
  96.  
  97.       return;
  98.    }
  99.  
  100.    // Check Ammo - If we are out, autoselect best weapon.
  101.    if(GetInv(player, 11) < 1.0)
  102.    {
  103.       PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
  104.       if(GetAutoSwitch() & 1)
  105.          SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
  106.       Return;
  107.    }
  108.  
  109.     SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3.0, 0, 0, 0);
  110.    SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
  111.  
  112.    if (GetInv(player, 93) > 0.0)
  113.    {
  114.       dummy = FireProjectile(player, projectileB, failSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
  115.    }
  116.    else
  117.       dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
  118.    ChangeInv(player, 11, -1.0);
  119.    jkPlayPOVKey(player, povfireAnim, 1, 0x38);
  120.  
  121.    powerBoost = GetInv(player, 63);
  122.    ChangeFireRate(player, fireWait/powerBoost);
  123.  
  124.    Return;
  125.  
  126. # ........................................................................................
  127.  
  128. activated:
  129.    player = GetSourceRef();
  130.    mode = GetSenderRef();
  131.    if (GetInv(player, 93) > 0.0)
  132.    {
  133.       SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
  134.       mode = 0;
  135.    }
  136.  
  137.    iBlastSize = 0;
  138.  
  139.    jkSetWaggle(player, '0.0 0.0 0.0', 0);
  140.    powerBoost = GetInv(player, 63);
  141.    ActivateWeapon( player, (fireWait/powerBoost) * (1.0+(mode/2)), mode );
  142.    Return;
  143.  
  144. # ........................................................................................
  145.  
  146. deactivated:
  147.    player = GetSourceRef();
  148.    mode = GetSenderRef();
  149.    if (GetInv(player, 93) > 0.0)
  150.       mode = 0;
  151.  
  152.    jkSetWaggle(player, '10.0 7.0 0.0', 350);
  153.    DeactivateWeapon( player, mode );
  154.  
  155.    if (mode == 1)
  156.    {
  157.          // Always shoot at least 1 shot (if possible)
  158.       if (iBlastSize == 0)
  159.       {
  160.          if (GetInv(player, 11) >= 1.0)
  161.          {
  162.             ChangeInv(player, 11, -1.0);
  163.             iBlastSize = 1;
  164.          }
  165.          else
  166.          {
  167.             return;
  168.          }
  169.       }
  170.  
  171.       i = iBlastSize;
  172.       iBlastSize = 0;
  173.  
  174.         SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3.0, 0, 0, 0);
  175.  
  176.       while (i > 0)
  177.       {
  178.          i = i - 1;
  179.  
  180.          vFire = VectorSet(0.0135, 0.1624+(i*0.01), 0);
  181.  
  182.          FireProjectile(player, projectile, fireSound, 8, vFire, '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
  183.       }
  184.  
  185.         // Check Ammo - If we are out, autoselect best weapon.
  186.         if(GetInv(player, 11) < 1.0)
  187.         {
  188.             PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
  189.             if(GetAutoSwitch() & 1)
  190.                 SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
  191.             Return;
  192.         }
  193.    }
  194.    Return;
  195.  
  196. # ........................................................................................
  197.  
  198. selected:
  199.    player = GetSourceRef();
  200.  
  201.    // Setup the meshes and models.
  202.    if (GetInv(player, 67) == 0.0)
  203.       jkSetPOVModel(player, povModel);    // Kyle hand
  204.    else
  205.       jkSetPOVModel(player, povModel_m);  // Mara Hand
  206.  
  207.    jkSetWeaponMesh(player, weaponMesh);
  208.    SetArmedMode(player, 1);
  209.  
  210.    // Play mounting sound.
  211.    PlayMode(player, 41);
  212.    PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);
  213.  
  214.    // Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
  215.    // The animation is held at the last frame after it is played.
  216.    trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
  217.    jkSetWaggle(player, '10.0 7.0 0.0', 350);
  218.  
  219.    // Clear saber flags, and allow activation of the weapon
  220.    jkClearFlags(player, 0x5);
  221.    SetCurWeapon(player, GetWeaponBin(12));
  222.    SetMountWait(player, GetKeyLen(mountAnim));
  223.  
  224.    Return;
  225.  
  226. # ........................................................................................
  227.  
  228. deselected:
  229.    player = GetSourceRef();
  230.    weaponIndex = GetSenderRef();
  231.  
  232.    PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
  233.    jkPlayPOVKey(player, dismountAnim, 0, 18);
  234.  
  235.    holsterWait = GetKeyLen(holsterAnim);
  236.    SetMountWait(player, holsterWait);
  237.    holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
  238.    SetTimerEx(holsterWait, 2, 0.0, 0.0);
  239.    if (trackID != -1)
  240.    {
  241.       jkStopPOVKey(player, trackID, 0);
  242.       trackID = -1;
  243.    }
  244.    jkSetWaggle(player, '0.0 0.0 0.0', 0);
  245.  
  246.    Return;
  247.  
  248. # ........................................................................................
  249.  
  250. autoselect:
  251.    player = GetSourceRef();
  252.  
  253.    // If the player has the weapon
  254.    if(GetInv(player, GetWeaponBin(12)) != 0.0)
  255.    {
  256.       // If the player has ammo
  257.       if(GetInv(player, 11) != 0.0)
  258.       {
  259.          ReturnEx(500.0);
  260.       }
  261.       else
  262.       {
  263.          ReturnEx(-1.0);
  264.       }
  265.    }
  266.    else
  267.    {
  268.       ReturnEx(-1.0);
  269.    }
  270.  
  271.    Return;
  272.  
  273. # ........................................................................................
  274.  
  275. timer:
  276.    StopKey(player, holsterTrack, 0.0);
  277.    Return;
  278.  
  279. end
  280.